// useToast.ts
// @/composables/useToast.ts
export const useToast = () => {
  const showToast = (message: string, duration = 2000) => {
    uni.showToast({
      title: message,
      icon: 'none',
      duration
    })
  }

  const showSuccess = (message: string, duration = 2000) => {
    uni.showToast({
      title: message,
      icon: 'success',
      duration
    })
  }

  const showError = (message: string, duration = 2000) => {
    uni.showToast({
      title: message,
      icon: 'error',
      duration
    })
  }

  const showLoading = (message = '加载中...') => {
    uni.showLoading({
      title: message
    })
  }

  const hideLoading = () => {
    uni.hideLoading()
  }

  return {
    showToast,
    showSuccess,
    showError,
    showLoading,
    hideLoading
  }
} 